<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
<title>影像采集查询页面</title>
<link rel="stylesheet" type="text/css" href="${ctx}/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${ctx}/easyui/easyui_my.css">
<link rel="stylesheet" type="text/css" href="${ctx}/easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="${ctx}/css/css.css" />
<script type="text/javascript" src="${ctx}/js/jquery-1.7.min.js"></script>
<script type="text/javascript" src="${ctx}/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${ctx }/easyui/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="${ctx}/js/common.js"></script>
<script type="text/javascript" src="${ctx}/js/AddTabs.js"></script>
<script type="text/javascript">
//设置指定日期
/* Date.prototype.format = function(fmt){
	var o = {"M+": this.getMonth()+1,        //月份
	"d+": this.getDate(),                    //日
	"h+": this.getHours(),                   //小时
	"m+": this.getMinutes(),                 //分
	"s+": this.getSeconds(),                 //秒
	"q+": Math.floor((this.getMonth()+3)/3), //季度
	"S" : this.getMilliseconds()             //毫秒
	};
	if(/(y+)/.test(fmt))
	fmt=fmt.replace(RegExp.$1,(this.getFullYear()+"").substr(4 - RegExp.$1.length));
	for(var k in o)
		if(new RegExp("("+ k +")").test(fmt))
	fmt= fmt.replace(RegExp.$1, (RegExp.$1.length==1)?(o[k]):(("00"+ o[k]).substr((""+o[k]).length)));
	return fmt;
};
//获取日期getData(0)今天,getData(7)七天前
function getDatex(day){
	var zdate=new Date();
	var sdate=zdate.getTime();
	var edate=new Date(sdate-(day*6*60*60*1000)).format("yyyy-MM-dd");
	return edate;
}
function getDatex1(day){
	var zdate=new Date();
	var sdate=zdate.getTime();
	var edate=new Date(sdate-(day*24*60*60*1000)).format("yyyy-MM-dd");
	return edate;
} */
$(function(){
    //视图,表格切换
    $(".chaxunjieguosdsnageqieh > li").click(function() {
      $(".chaxunjieguosdsnageqieh > li").removeClass("gudingshitukjye");
      $(this).addClass("gudingshitukjye");     
    });
    //初始化号牌种类下拉框
    $("#hpzlSelect").combobox({
    	prompt:'请选择号牌种类',
		valueField: 'dmz'
		,textField: 'dmsm1'
		,url:'${ctx}/code/findCodeByCodetype.htm?xtlb=00&dmlb=1007'
  	});
    $("#hpzlSelect").combobox('setValue','02');
    //设置日期初始值
 	//$("#startTime").datetimebox("setValue",getDatex(8));
 	//$("#endTime").datetimebox("setValue",getDatex1(-1));
 	//$("#daztSelect").combobox('setValue','4');
    // initTable(1,20);
});

//数据表
function initTable(pageNumber,pageSize,v_hphm,v_hpzl,v_lsh,v_dabh){

     $("#TableData").datagrid({
       url:'${ctx}/yxxx/findYxcjPage.htm',
       fitColumns:false,
       border:false,
       striped:true,
       singleSelect:true,
       pagination: false,
       //pageSize: 10,                //每页记录数
       pageList: [5, 10, 15, 20, 30, 50], //分页记录数数组
       /* remoteSort:false,//是否从服务器排序数据*/
       loadMsg:'数据加载中请稍后……', 
       queryParams:{
    	   pageSize:pageSize,
	       page:pageNumber,
	       hphm:v_hphm,
	       hpzl:v_hpzl,
	       lsh:v_lsh,
	       dabh:v_dabh
	       },
       columns:[[
		 {field:'lsh',title:'流水号',width:'10%',fixed:true,align:'center',split:true},
         {field:'hphmmc',title:'号牌号码',width:'8%',fixed:true,align:'center',split:true},
         {field:'hpzlmc',title:'号牌种类',width:'8%',fixed:true,align:'center',split:true},
         {field:'clpp1',title:'车辆品牌',width:'10%',fixed:true,align:'center',split:true},
         //{field:'csysmc',title:'车身颜色',width:'7%',fixed:true,align:'center',split:true},
         {field:'syr',title:'所有人',width:'15%',fixed:true,align:'center',split:true},
         //{field:'fdjh',title:'发动机号',width:'10%',fixed:true,align:'center',split:true},
         {field:'clsbdh',title:'车辆识别代号',width:'14%',fixed:true,align:'center',split:true},
         {field:'ywmc',title:'业务类型',width:'12%',fixed:true,align:'center',split:true},
         {field:'cjrxm',title:'经办人',width:'8%',fixed:true,align:'center',split:true},
         {field:'cjsj',title:'经办时间',width:'10%',fixed:true,align:'center',split:true},
        /*  {field:'zt',title:'状态',width:'6%',align:'center',fixed:true,split:true,formatter:function(value,row,index){
        	  if(row.dazt=="1"){
        		 return "<a class=\"chense\" >待审核</a>";
        	  }else if(row.dazt=="3"){
        		 return "<a class=\"chense1\" >重新采集</a>";
        	 }       	 
	  	 }}, */
        {field:'cz',title:'操作',width:'6%',align:'center',fixed:true,split:true,formatter:function(value,row,index){
     		 return "<a class=\"chense\" href=\"javascript:CheckInfo('"+row.xh+"','"+row.lsh+"','"+index+"')\" >编辑</a>";
     	 
	  	 }}
    ]],
       onDblClickRow: function (rowIndex, rowData) {
    	   CheckInfo(rowData.xh);
       },
       onLoadSuccess: function (data) {
         initPage(data.total,data.pageSize);
       }
     });
} 

function initPage(total,pageSize){
	 var chrng = /.*[\u4e00-\u9fa5]+.*$/;
      $('#pp').pagination({
        total:total,
        pageSize:pageSize,
        onSelectPage:function(pageNumber, pageSize){
		  $("#TableData").datagrid("load",{
			  	pageSize:pageSize,
		        page:pageNumber,
		        hphm:$("#hphmSelect").val().replace(chrng, ""),
		        hpzl:$("#hpzlSelect").combobox('getValue'),
		        startTime:$("#startTime").combobox('getValue'),
		        endTime:$("#endTime").combobox('getValue'),
		        lsh:$("#lshSelect").val()
		  });
      	}
    });
}
function CheckInfo(xh,lsh,_index){
	var param=getParamLsh(lsh,_index,'lsh');
	var hphm = $("#hphmSelect").val();
	var reg = /[\u4e00-\u9fa5]/g;//筛选是否有中文
	hphm = hphm.replace(reg, "");
	var lsh=$("#lshSelect").val();
	var dabh=$("#dabhSelect").val();
	var hpzl = $("#hpzlSelect").combobox('getValue');
	param+="&xh="+xh;
	parent.addTab("机动车档案补录详情","${ctx}/yxxx/findYxcjByxhFirstIn.htm"+param);
} 
/* function CheckInfo(xh){
	var hphm = $("#hphmSelect").val();
	var reg = /[\u4e00-\u9fa5]/g;//筛选是否有中文
	hphm = hphm.replace(reg, "");
	var hpzl = $("#hpzlSelect").combobox('getValue');
	var startTime = $("#startTime").combobox('getValue');
	var endTime = $("#endTime").combobox('getValue');
	//var dazt = $("#daztSelect").combobox('getValue');
	parent.addTab("机动车档案编辑","${ctx}/yxxx/findYxcjByxhFirstIn.htm?xh="+xh+"&hphm="+hphm+
			"&hpzl="+hpzl+"&startTime="+startTime+"&endTime="+endTime);
}  */

//根据界面中的样件，过滤查询机动车基本信息列表
function queryDataGrid(){
	var v_xzqhId=$("#xzqhId").text();
	var hphm = $.trim($("#hphmSelect").val());
	var reg = /[\u4e00-\u9fa5]/g;//筛选是否有中文
	hphm = hphm.replace(reg, "").toUpperCase();
	v_xzqhId=v_xzqhId.replace(reg,"");
	if(hphm.length!=0){
		hphm=v_xzqhId+hphm;
	}
	var hpzl = $("#hpzlSelect").combobox('getValue');
/* 	var startTime = $("#startTime").combobox('getValue');
	var endTime = $("#endTime").combobox('getValue'); */
	var lsh = $.trim($("#lshSelect").val());
	var dabh=$.trim($("#dabhSelect").val());
	  /* $("#TableData").datagrid("load",{
		  hphm:hphm,
	      hpzl:hpzl,
	      startTime:startTime,
	      endTime:endTime,
	      lsh:lsh
	  }); */
	 if(hphm.length!=0 || lsh.length!=0 || dabh.length!=0){
		  	initTable(1,20,hphm,hpzl,lsh,dabh);
		  }
}
</script>
</head>
<body class="easyui-layout" options="border:false">
<%-- <c:if test="${not empty sbxh }">
<input type="hidden" id="sbxh" value="${sbxh }">
</c:if> --%>
<div data-options="region:'north',height:60,border:false" style="padding-left:10px;padding-right: 10px;padding-top: 5px;">
  <div class="xinxichaxunkuangz1">
    <div class="dashujtiaojianxuanxiangkuan">
      <div class="dashujtiaojianxuanxiangkuan_lie">
          <div class="tiaojian_key">流水号：</div>
          <div class="tiaojian_values">
            <ul class="tiaojian_values_limian">
              <li><input id="lshSelect" type="text" class="shurukuangkais" placeholder='请输入流水号'/></li>
              <li><span class="buchongdbiaotdsw">档案编号：</span>
              <input id="dabhSelect" type="text" class="shurukuangkais" placeholder='请输入档案编号'/></li>
              <li><span class="buchongdbiaotdsw">号牌号码：<a id="xzqhId" style="font-weight: bold; color: #777777;"></a></span>
                <input id="hphmSelect" type="text" name="hphmSelect" placeholder='请输入号牌号码' class="shurukuangkais"/>
              </li>
              <li><span class="buchongdbiaotdsw">号牌种类：</span>
                <input id="hpzlSelect" type="text" name="hpzlSelect" class="shurukuangkais"/>
              </li>
            </ul>
          </div>
        </div>
        <!-- <div class="dashujtiaojianxuanxiangkuan_lie">
          <div class="tiaojian_key">号牌号码：</div>
          <div class="tiaojian_values">
            <ul class="tiaojian_values_limian">
              <li><input id="hphmSelect" type="text" class="shurukuangkais" placeholder='请输入号牌号码'/></li>
              <li><span class="buchongdbiaotdsw">号牌种类：</span>
                <input id="hpzlSelect" class="easyui-combobox shurukuangkais"/>
              </li>
            </ul>
          </div>
        </div> -->
<!--         <div class="dashujtiaojianxuanxiangkuan_lie">
          <div class="tiaojian_key">流水号：</div>
          <div class="tiaojian_values">
            <ul class="tiaojian_values_limian">
              <li><input id="lshSelect" type="text" class="shurukuangkais" placeholder='请输入流水号'/></li>
            </ul>
          </div>
        </div> -->
      </div>
      <div class="chaxunchongzhianniu">
        <a href="javascript:queryDataGrid()" class="sousuocx">查询</a>
        <!-- <a href="javascript:applyForAuth()" class="sousuocx">机动车录入</a> -->
      </div>
    </div>
 </div>
<div data-options="region:'center',border:false" style="padding-left:10px;padding-right: 10px">
  <div class="easyui-layout xinxichaxunkuangz2" data-options="fit:true,border:false">
    <div class="tupianqiehuantop" data-options="region:'north',border:false" style="height: 37px">
      <span class="chaxunjieguosd">搜索结果</span>
    </div>
    <div id="tableDiv" data-options="region:'center',border:false" style="overflow-y: auto;">
      <table id="TableData" data-options="cls:'biaogeycangds',fit:true"></table>
    </div>
    <div data-options="region:'south',border:false" style="height:32px">
      <div class="easyui-panel">
        <div class="easyui-pagination" id="pp"></div>
      </div>
     </div>
      <%--  <jsp:include page="/WEB-INF/content/yxcj/vehicle/addVehcile.jsp" /> --%>
  </div>

</div>
<script type="text/javascript">
$(function(){
    ClickXzqhFun();
})
function ClickXzqhFun(){
	   var obj = document.getElementById('xzqhId');
	   $.ajax({
			type:'POST',
	        url:'${ctx}/user/selectSsbmOfUser.htm',
	        data:{},
	        dataType:'json',
	        success:function(data, textStatus, jqXHR){
	        	if(data.glbm=='340000000400' || data.rid=='43')
	        		obj.innerText='皖';
	        		else obj.innerText=data.fzjg;
	        }
	   });	  
}
</script>
</body>
</html>
